#!/usr/bin/perl

use strict;
use warnings;

use Template;

my $tt = Template->new;

open TABLES, "tables.txt";

while (<TABLES>) {
   chomp;
   my $name = $_;
   $_ =~ s/\b(\w)/\u$1/g;
   $_ =~ s/_(\w)/\u$1/g;
   my $bigname = $_;
   my %data = (
      big_name => $bigname,
      name => $name
   );
   $tt->process("test.tt",\%data,'temp.pl');
   my $output = `perl temp.pl`;
   open OUTFILE, ">$bigname.pm";
   print OUTFILE $output;
   close OUTFILE;
}

close TABLES;
